import { stringify } from 'qs';
import request from '@/utils/request';

import webpath from '@/utils/webpath';

export async function deleteByPrimaryKeyForProTables(params = {}) {
    return request(`/${webpath}/web/api/service/protables/delete?${stringify(params)}`);
}


export async function selectByPrimaryKeyForProTables(params = {}) {
    return request(`/${webpath}/web/api/service/protables/get?${stringify(params)}`);
}


export async function insertForProTables(params = {}) {
    return request(`/${webpath}/web/api/service/protables/insert`, {
        method: 'POST',
        data: {
            ...params,
            method: 'insert',
        },
    });
}


export async function updateForProTables(params = {}) {
    return request(`/${webpath}/web/api/service/protables/update`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}


export async function deleteByMapForProTables(params = {}) {
    return request(`/${webpath}/web/api/service/protables/deleteByMap`, {
        method: 'POST',
        data: {
            ...params,
            method: 'delete',
        },
    });
}


export async function updateByMapForProTables(params = {}) {
    return request(`/${webpath}/web/api/service/protables/updateByMap`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}


export async function getOneForProTables(params = {}) {
    return request(`/${webpath}/web/api/service/protables/getOne`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}



export async function getAllForProTables(params = {}) {
    return request(`/${webpath}/web/api/service/protables/getAll`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}


export async function queryPageForProTables(params = {}) {
    return request(`/${webpath}/web/api/service/protables/queryPage`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}


export async function countForProTables(params = {}) {
    return request(`/${webpath}/web/api/service/protables/count`, {
        method: 'POST',
        data: {
            ...params,
            method: 'fetch',
        },
    });
}

export async function insertBatchForProTables(params = {}) {
    return request(`/${webpath}/web/api/service/protables/insertBatch`, {
        method: 'POST',
        data: {
            ...params,
            method: 'insert',
        },
    });
}


export async function deleteBatchForProTables(params = {}) {
    return request(`/${webpath}/web/api/service/protables/deleteBatch`, {
        method: 'POST',
        data: {
            ...params,
            method: 'delete',
        },
    });
}


export async function updateBatchForProTables(params = {}) {
    return request(`/${webpath}/web/api/service/protables/updateBatch`, {
        method: 'POST',
        data: {
            ...params,
            method: 'update',
        },
    });
}